package com.tgl.vegetables.plug.service;

import android.accessibilityservice.AccessibilityService;
import android.util.Log;
import android.view.accessibility.AccessibilityEvent;

import com.tgl.vegetables.plug.dingdong.DingDongAccessibilityService;
import com.tgl.vegetables.plug.hema.HemaAccessibilityService;
import com.tgl.vegetables.plug.meitu.MeituAccessibilityService;

import java.util.HashMap;
import java.util.Map;

public class PlugAccessibilityService extends AccessibilityService {

    private static final String TAG = "PlugAccessibilityService";

    private static Map<String,IAccessibilityService> SERVICES = new HashMap<String,IAccessibilityService>(){

        {
            put("com.yaya.zone",new DingDongAccessibilityService());
            put("com.sankuai.meituan",new MeituAccessibilityService());
            put("com.wudaokou.hippo",new HemaAccessibilityService());
        }
    };

    @Override
    public void onAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
        IAccessibilityService service = SERVICES.get(accessibilityEvent.getPackageName());
        if(service != null){
            service.onAccessibilityEvent(this,accessibilityEvent);
        }
    }

    @Override
    public void onInterrupt() {

    }
}
